<template>
  <div class="g2-ueditor" ref="ueditor">
    <!-- <script id="editor" type="text/plain"></script> -->
  </div>
</template>

<script>
import "@public/lib/ue/ueditor.config.js";
import "@public/lib/ue/ueditor.all.js";
import "@public/lib/ue/lang/zh-cn/zh-cn.js";
import "@public/lib/ue/ueditor.parse.min.js";

export default {
  name: "g2Ue",
  data() {
    return {
      editor: null
    };
  },
  props: {
    value: "",
    config: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  mounted() {
 
    let _this = this;
    _this.editor = window.UE.getEditor(_this.$refs.ueditor, _this.config);
    _this.editor.addListener("ready", () => {
      _this.editor.setContent(_this.value);
    });
  },
  methods: {
    getUEContent() {
      return this.editor.getContent();
    }
  },
  destroyed() {
    this.editor.destroy();
  }
};
</script>

<style scoped lang="scss">
.g2-ueditor {
  display: inline-block;
  width: 100%;
}
</style>
